import { makeAutoObservable, runInAction } from 'mobx'
import Service from '../service'
class departmentSettingsStore {
    constructor() {
        makeAutoObservable(this)
    }
    value = ''
    upId = ''
    title = ''
    upTitle = ''
    // newRole = ''
    newMenu_id = ''
    upMenu_id = ''
    total = ''
    page_size = 10
    current_page = 1
    upUserInfo = {}
    searchInfo = {

    }
    addInfo = {
        account: null,//账号
        password: null,//登录密码
        user_name: null,//昵称
        department: null,//部门 ----------------------------------------------------
        user_role: null,//角色  -------------------------------------------------------
        customer_quantity_limit: null,//客户数量
        commission: null,//提成
        status: 1,//状态
        phone_number: null,//手机号码
        user_email: null,//email
        sex: null,//性别
        birthday: null,//生日
        id_number: null,//身份证
        joining_time: null,//入司时间
        hometown: '',//家乡
        address: null,//家庭住址
        emergency_contact: null,//紧急联系人
        emergency_phone: null,//紧急联系电话
        person_introduction: null,//个人介绍
        personal_signature: null,//个性签名
        resignation_status: null,//离职状态
        resignation_time: null,//离职时间
        resignation_reason: null,//离职原因

    }

    data = ''
    setValue(value) {
        this.value = value
    }
    setUpId(value) {
        this.upId = value
    }
    setTitle(value) {
        this.title = value
    }
    // setnewRole(data) {
    //     this.newRole = data
    // }
    setNewMenu_id(value) {
        this.newMenu_id = value
    }
    setUpTitle(value) {
        this.upTitle = value
    }
    setupMenu_id(value) {
        this.upMenu_id = value
    }
    setUpUserInfo(value) {
        this.upUserInfo = value
    }
    setSearchInfo(value) {
        this.searchInfo = value
    }
    setCurrent_page(value) {
        this.current_page = value
    }
    setPage_size(value) {
        this.page_size = value
    }
    getList = async () => {
        const current_page = this.current_page
        const page_size = this.page_size
        const res = await Service.StaffManage.EmployeeList.freshList({ current_page, page_size })
        console.log(res);
        runInAction(() => {
            this.total = res.count
            this.data = (res.data.map((item) => {
                item.key = item.user_id
                return item
            }))
        })

    }
    setData(value) {
        this.data = value
    }
    setAddInfo(value) {
        this.addInfo = value

    }

}
export default departmentSettingsStore